<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<script language="JavaScript">
	function KiemTraMS() {
		if (a.masach.value.length > 10)
			alert("Báº¡n da go qua so ki tu cho phep !");
	}
	function CheckSo(evt)
	{
		var charCode=(evt.which)?evt.which:event.keyCode
				if(charCode>31&& (charCode<48||charCode>57))
					return false;
		return true;
	}

	function KiemTra()

	{
		//if (masach.value.length > 200) alert("Báº¡n Ä‘Ã£ gÃµ qÃºa sá»‘ kÃ½ tá»± cho phÃ©p !");

		var err = "";
		if (a.masach.value == "") {
			err += " ++masach++";

		}

		if (a.tensach.value == "") {
			err += " ++tensach++";

		}
		if (a.theloai.value == "") {
			err += " ++theloai++";

		}
		if (a.tacgia.value == "") {
			err += " ++tacgia++";

		}
		if (a.noidung.value == "") {
			err += " ++noidung++";

		}
		if (a.gianhap.value == "") {
			err += " ++gia nhap++";

		}
		if (a.giaban.value == "") {
			err += " ++gia ban++";

		}
		if (err != "") {
			alert("ban khong duoc bo" + err);
		}

	}
</script>
<body>
	<form action="InsertServlet" name="a" onsubmit="return kiemtra();">
		<table width="399" border="2" align="center" cellpadding="5"
			cellspacing="5">
			<tr>
				<th colspan="2" scope="col">THEM THONG TIN SACH</th>
			</tr>
			<tr>
			<tr>
				<td width="131">Ma Sach</td>
				<td width="225"><label for="masach"></label> <input type="text"
					name="MaSach" id="MaSach" onKeyUp="KiemTraMS();" /></td>
			</tr>
			<tr>
				<td width="131">Ten Sach</td>
				<td width="225"><label for="tensach"></label> <input
					type="text" name="TenSach" id="TenSach" /></td>
			</tr>
			<tr>
				<td width="131">The Loai</td>
				<td width="225"><label for="theloai"></label> <input
					type="text" name="TheLoai" id="TheLoai" /></td>
			</tr>
			<tr>
				<td width="131">TacGia</td>
				<td width="225"><label for="tacgia"></label> <input type="text"
					name="TacGia" id="TacGia" /></td>
			</tr>
			<tr>
				<td width="131">NXB</td>
				<td width="225"><label for="nxb"></label> <input type="text"
					name="NXB" id="NXB" /></td>
			</tr>
			<tr>
				<td width="131">Gia Nhap</td>
				<td width="225"><label for="gianhap"></label> <input
					type="text" name="GiaNhap" id="GiaNhap"
					onkeydown="return CheckSo(event)" /></td>
			</tr>
			<tr>
				<td width="131">Gia Ban</td>
				<td width="225"><label for="giaban"></label> <input type="text"
					name="GiaBan" id="GiaBan" onkeydown="return CheckSo(event)" /></td>
			</tr>
			<tr>
				<td width="131">Noi Dung</td>
				<td width="225"><label for="noidung"></label> <input
					type="text" name="noidung" id="NoiDung" /></td>
			</tr>
			<tr>
				<td><div align="right"></div></td>
				<td><input type="submit" name="Submit" value="Save"
					onclick="KiemTra()" /> <input type="reset" name="Submit2"
					value="Huy" /></td>
			</tr>
		</table>
	</form>

</body>
</html>